<template>
  <div class="app">
    <div class="special_top">
      <p class="router-link-active">
        <i class="van-icon van-icon-arrow-left" @click="adds"></i>
      </p>
      <p>人气推荐</p>
      <p></p>
    </div>
    <div id="alllist">
      <ul>
        <li v-for="item in list" :key="item.id" @click="changs(item)">
          <img :src="item.pic" alt="" />
          <p>{{item.name}}</p>
          <p></p>
          <p>￥{{item.originalPrice}}</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { getlists } from "@/utils/api/home.js";

export default {
  data() {
    return {
      list: [],
    };
  },
  mounted() {
    getlists().then((res) => {
      console.log(res);
      this.list = res.data.data;
    });
  },
  methods: {
    adds() {
      this.$router.go(-1);
    },
    changs(item){
      this.$router.push({ path: "/renxiang", query: { obj: item } });
    }
  },
};
</script>

<style lang='scss'>
.app{
    width: 100%;
}
.special_top {
  width: 100%;
  height: 1rem;
  background: #ffffff;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 0 0.15rem;
  position: fixed;
  left: 0;
  top: 10;
  z-index: 100;
}
.special_top > p:nth-of-type(1) {
  font-size: 0.3rem;
}
.van-icon {
  position: relative;
  display: inline-block;
  font: normal normal normal 14px/1 vant-icon;
  font-size: inherit;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}
.special_top > p:nth-of-type(2) {
  font-size: 0.34rem;
}
#alllist {
  padding-top: 1.1rem;
  width: 100%;
  border-bottom: 0.14rem solid #f5f5f5;
}
#alllist > ul {
  width: 100%;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
}
#alllist > ul > li img {
  width: 3.5rem;
  height: 4.4rem;
  display: block;
}
#alllist>ul>li>p:nth-of-type(1) {
    font-size: 0.3rem;
    color: #000000;
    width: 3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#alllist>ul>li>p:nth-of-type(3) {
    font-size: 0.16rem;
    color: #D00000;
    margin-top: 0.2rem;
}
</style>
